home *** CD-ROM | disk | FTP | other *** search
/ PC Answers 1998 January / PC Answers Issue 49 Cover CD January 1998.iso / Apps / Director / DATA.Z / Behavior Library.cst / 00015_Message All Sprites.ls < prev    next >
Encoding:
Text File  |  1997-05-09  |  1.9 KB  |  72 lines

  1. -- Message   Send to All Sprites  
  2.  
  3. -- Messaging
  4. -- EventtoSend must be a symbol
  5. -- whichEvent inits the action
  6.  
  7. -- also functions through lingo by handling message 'initSendAllSprites', 
  8. -- for example if this behavior was assigned to sprite 5, use
  9. -- sendsprite 5, #initSendAllSprites
  10.  
  11. property whichEvent, eventToSend, params
  12.  
  13. on initSendAllSprites me
  14.   init me
  15. end
  16.  
  17. on mouseUp me
  18.   if whichEvent = #mouseup    then init me
  19. end
  20.  
  21. on mouseDown me
  22.   if whichEvent = #mousedown  then init me
  23. end
  24.  
  25. on prepareFrame me
  26.   if whichEvent = #prepareframe then init me
  27. end
  28.  
  29. on enterFrame me
  30.   if whichEvent = #enterframe then init me
  31. end
  32.  
  33. on exitFrame me
  34.   if whichEvent = #exitframe  then init me
  35. end
  36.  
  37. on init me
  38.   set doit = "sendAllSprites the EventToSend of me," && params
  39.   do doit
  40. end
  41.  
  42. ---
  43.  
  44. on getPropertyDescriptionList
  45.   
  46.   set p_list = [ ┬¼
  47.    #EventToSend: [ #comment:   "Message:", ┬¼
  48.                     #format:   #symbol, ┬¼
  49.                    #default:   #generic_event ], ┬¼
  50.    #Params:      [ #comment:   "Param1, param2, ...", ┬¼
  51.                     #format:   #string, ┬¼
  52.                    #default:   "" ], ┬¼
  53.     #WhichEvent: [ #comment:   "Initializing Event:", ┬¼
  54.                     #format:   #symbol, ┬¼
  55.                      #range: [ #MouseUp, #MouseDown, #PrepareFrame, #EnterFrame, #ExitFrame, #InitSendAllSprites], ┬¼
  56.                    #default:   #MouseUp ] ┬¼
  57.                  ]
  58.   return p_list
  59.   
  60. end
  61.  
  62. on getBehaviorDescription
  63.   return ┬¼
  64. "Sends a message to every sprite in the current frame when the specified event occurs. Any behaviors that are triggered by the message will be executed." & RETURN & ┬¼
  65. "PARAMETERS:" & RETURN & ┬¼
  66. "ΓÇó Message - Enter the message to send."  & RETURN & ┬¼
  67. "ΓÇó Params  - Enter the parameters to be sent with the message, seperated by commas."  & RETURN & ┬¼
  68. "ΓÇó Initializing Event - Specify the event that triggers the behavior."   
  69.   
  70. end
  71.  
  72.